﻿// -----------------------------------------------------------------------
// <copyright file="HostInfo.cs" company="DarkBone">
// DarkBone
// </copyright>
// -----------------------------------------------------------------------

namespace DarkBone.Engine.Networking
{
   using System;
   using System.Net;

   /// <summary>
      /// Data holder for information about server
      /// </summary>
      [Serializable]
      public struct HostInfo
      {
         #region Constants and Fields

         /// <summary>
         /// Addresses of host
         /// </summary>
         public readonly IPAddress[] Addresses;

         /// <summary>
         /// Host name
         /// </summary>
         public readonly string HostName;

         /// <summary>
         /// Listening port
         /// </summary>
         public readonly int Port;

         #endregion

         #region Constructors and Destructors

         /// <summary>
         /// Initializes a new instance of the <see cref="HostInfo"/> struct. 
         /// </summary>
         /// <param name="hostName">
         /// Host Name
         /// </param>
         /// <param name="hostEntry">
         /// IP Host Entry
         /// </param>
         /// <param name="port">
         /// Listening port
         /// </param>
         public HostInfo(string hostName, IPHostEntry hostEntry, int port)
            : this()
         {
            this.HostName = hostName;
            this.Addresses = hostEntry.AddressList;
            this.Port = port;
         }

         #endregion
      }
}
